package com.aoyebobi;

import java.awt.*;

/**
 * @Description
 * @Author aoyebobi
 * @Date 2024-09-05
 */

public class BorderLayoutDemo {

    public static void main(String[] args) {
        Frame frame = new Frame("BorderLayout");
        frame.setBounds(100,100,400,300);
//        frame.setLayout(new BorderLayout());  默认布局

        Button button1 = new Button("button1");
        Button button2 = new Button("button2");
        Button button3 = new Button("button3");
        Button button4 = new Button("button4");
        Button button5 = new Button("button5");

        button1.setBackground(Color.BLACK);
        button2.setBackground(Color.BLUE);
        button3.setBackground(Color.YELLOW);
        button4.setBackground(Color.GREEN);
        button5.setBackground(Color.CYAN);

        frame.add(button1, BorderLayout.EAST);
        frame.add(button2, BorderLayout.WEST);
        frame.add(button3, BorderLayout.NORTH);
        frame.add(button4, BorderLayout.SOUTH);
        frame.add(button5, BorderLayout.CENTER);

        frame.setVisible(true);
    }
}
